package com.adou;

import com.adou.config.SpringConfig;
import com.adou.dao.BookDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App2 {
    public static void main(String[] args) {
        //1.获取IoC容器
        ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
        //2.获取bean（根据bean配置id获取）
        BookDao bookDao = (BookDao) ctx.getBean("bookDao");
        bookDao.save();
    }
}
